import "./assets/main.css"

import { createApp } from "vue"
import ElementPlus from "element-plus"
import "element-plus/dist/index.css"
// @ts-expect-error  将element默认的英文替换成本土化的中文内容
import zhCn from "element-plus/dist/locale/zh-cn.mjs"
import { createPinia } from "pinia"
import persist from "pinia-plugin-persistedstate"
import * as ElementPlusIconsVue from "@element-plus/icons-vue"
import SystemConfirm from "./utils/confirm.ts"
import SysMessage from "./utils/message.ts"

import App from "./App.vue"
import router from "./router"

const app = createApp(App)

const pinia = createPinia()
pinia.use(persist)
app.use(ElementPlus, {
	locale: zhCn,
})
app.use(pinia)
app.use(router)

app.config.globalProperties.$confirm = SystemConfirm
app.config.globalProperties.$message = SysMessage

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
	app.component(key, component)
}

app.mount("#app")
